#include "or_rule.h"
#include "table.h"

using namespace fouine;
using namespace std;

OrRule::OrRule()
{}

OrRule::OrRule(const vector<RuleId>& rule_ids_):_rule_ids(rule_ids_)
{
}

Likelihood OrRule::match(const String&, StrId start,  StrLen length, const Table& table) const
{
  Likelihood res = 0.;
  vector<RuleId>::const_iterator rule_it;
  for (rule_it = _rule_ids.begin();
       rule_it!= _rule_ids.end();
       rule_it++)
  {
    RuleId rule_id = *rule_it;
    res = max(res, table(start, length, rule_id) );
  }
  return res;
}
